//
//  FiveViewController.m
//  UITestDemo
//
//  Created by Qianfeng on 15/8/14.
//  Copyright (c) 2015年 Qianfeng. All rights reserved.
//

#import "FiveViewController.h"
#import "SexViewController.h"
@interface FiveViewController ()
{
    UILabel *_infoLabel;
}
@end

@implementation FiveViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initUI];
}
-(void)initUI
{
    _infoLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 70, self.view.frame.size.width-40, 40)];
    _infoLabel.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:_infoLabel];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(20, 130, self.view.frame.size.width-40, 40);
    [button setTitle:@"进入下一页" forState:UIControlStateNormal];
    button.titleLabel.textAlignment = NSTextAlignmentCenter;
    button.titleLabel.textColor = [UIColor whiteColor];
    button.backgroundColor = [UIColor lightGrayColor];
    [button addTarget:self action:@selector(toNext) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
}
-(void)toNext
{
    SexViewController *svc = [[SexViewController alloc]init];
    [svc setHandler:^(NSString *string){
        _infoLabel.text = string;
    }];
       [self.navigationController pushViewController:svc animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
